package com.cgwx.commonutils.math.function;

/**
 * @author GaoWei
 * @Date 2021/8/6 - 9:50
 */
public class LogFunction implements Function
{
    public double of(double[] d, int numParam)
    {
        if (numParam == 1) {
            return Math.log(d[0]) / Math.log(10.0D);
        }
        return Math.log(d[0]) / Math.log(d[1]);
    }

    public boolean acceptNumParam(int numParam)
    {
        return (numParam == 1) || (numParam == 2);
    }

    public String toString()
    {
        return "log(x):log(x, y)";
    }
}
